package co.angluzha.data.student.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import java.util.Date;
import java.io.Serializable;


/**
 * 学生表(Student)实体类
 *
 * @author makejava
 * @since 2022-11-22 09:52:24
 */
@Data
@Accessors(chain = true)
public class Student implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    @NotNull(groups = Update.class)
    private Long id;
    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空")
    private String sname;
    /**
     * 年龄
     */
    @NotNull(message = "年龄不能为空")
    @Range(max = 60,min = 12,message = "年龄范围应在{min}到{max}之间")
    private Integer age;
    /**
     * 生日
     */
    @NotNull(message = "生日不能为空")
    @Past(message = "生日范围错误")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    /**
     * 创建时间
     */
    private Date createTime = new Date();
    /**
     * 最后一次修改时间
     */
    private Date updateTime = new Date();
    /**
     * 状态
     */
    private Integer status = 0;
    /**
     * 删除标识 0-正常 1-已删除
     */
    private Integer delFlag = 0;

    public static class Insert{}
    public static class Update{}
}

